﻿using System;
using System.Collections.Generic;

using Perseus;
using Perseus.Data;
using Perseus.Plugins;

using Hetymine.Executioner.Commands;
using Hetymine.Executioner.Data;

namespace Hetymine.Executioner.Plugins.General.Network {
    public class Network : Plugin, IExecutableCommands, ILoader, IConfigurable<IniFile> {
        private NetworkConfigurator _Configurator;

        public Network() {
            this.PluginInfo = PluginInfo.FromAssembly(
                "Command Box",
                this.GetType().Assembly,
                "Blake Hancock",
                "http://hetymine.com/executioner/plugins/general/commandbox/"
            );
        }
        #region IExecutable
        public System.Collections.Generic.List<string> CallStrings { get; protected set; }
        public ExecutionResult ExecuteCommand(string callString, string parameters) {
            if (callString == this.CallStrings[0]) { // Send

            }
            else if (callString == this.CallStrings[1]) { // Join

            }
            else if (callString == this.CallStrings[2]) { // Quit

            }

            // Never reached
            return ExecutionResult.Error;
        }
        #endregion
        #region ILoader Members
        public void Load() {
            this.CallStrings = new List<string>();            
            this.CallStrings.Add(Executioner.Config.GetString("Network", "Send Call String", "send"));
            this.CallStrings.Add(Executioner.Config.GetString("Network", "Join Call String", "join"));
            this.CallStrings.Add(Executioner.Config.GetString("Network", "Quit Call String", "quit"));
        }
        public void Unload() {
        }
        #endregion
        #region IConfigurable<IniFile>
        public IConfigurator<IniFile> Configurator {
            get {
                if (this._Configurator == null) {
                    this._Configurator = new NetworkConfigurator();
                }

                return this._Configurator;
            }
        }
        #endregion
    }
}
